<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
<%@ include file="/common/init.jsp"%>
<html>
<head>
<title>澳斯浪廷会员平台</title>
<link href="<c:url value='/resources/css/css.css'/>" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="<c:url value='/resources/js/jquery-1.7.2.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/resources/js/validate.js'/>"></script>
<script type="text/javascript" src="<c:url value='/resources/js/MathUtil.js'/>"></script>
</head>
<body leftmargin="0">
<div class="main">
<div class="width_l">
    <iframe src="menu.action" frameborder="0" width="250" height="100%" class="menu"></iframe>
</div>    
    <div class="right">
    <div class="width_r">
        <div class="menu_r">
            <ul>
                <li><a href="index.action">首页</a></li>
                <li><a href="information.action">消息</a></li>
                <li><a href="notice.action">公告中心</a></li>
                <li><a href="news.action">新闻中心</a></li>
                <li><a href="inbox.action">收件箱</a></li>
                <li><a href="tomail.action">写邮件</a></li>
                <li><a href="sent.action">已发送</a></li>
                <li><a href="${ctx}/exit.action">安全退出</a></li> 
            </ul>
        </div>
        <div class="news_top"><img src="<c:url value='/resources/images/top.jpg'/>" /></div>
        <div class="news">
            <div class="yxd_title">
              <div class="yxd_left">游戏豆交易</div>
                <div class="yxd_right"><!-- <a href="yxdmore.action">查看个人交易信息</a> --></div>
            </div>
			<div class="gupiao">
				<div class="gp_left">
					<table width="360" border="0" cellspacing="0" cellpadding="0">
					 <%--  <tr>
					    <td colspan="2">最后一次成交记录    成交${userStockInfo.stockQuantity}股  ${userStockInfo.createDate}</td>
					    </tr> --%>
					  <tr>
					    <td width="271" valign="top" style="background:url(<c:url value='/resources/images/pic.jpg'/>) no-repeat center bottom; height:110px; font-size:20px; font-weight:bold;">当前价格：${price}</td>
					    <td width="139"><img src="<c:url value='/resources/images/goumai.jpg'/>" /><img style=" margin-top:15px;" src="<c:url value='/resources/images/guchu.jpg'/>" /></td>
					  </tr>
					</table>
				</div>
				<div class="gp_right">
					<table width="340" border="0" cellspacing="0" cellpadding="0" style="margin-left: 50px;">
					  <tr>
					    <td width="340">A股票持有量：${userAccount.stockNum}</td>
					  </tr>
					  <tr>
					    <td width="340">B股票持有量：${userAccount.stockSaleNum}</td>
					  </tr>
					  <%-- <tr>
					    <td width="340">股票持有量：${userAccount.stockSaleNum}</td>
					  </tr> --%>
					  <tr>
					    <td width="340">当前价值：${usetStockTotal}</td>
					  </tr>
					</table>
				</div>
            </div>
           	<br/>
            <div align="left" style="margin-left: 200px;">距离下次股票涨价数量：${totalStock}</div>
            <br/>
        <!--  -->
<%-- 		<div id="conversionlist">
			<div class="vvbt" style="margin-top: 20px;">
				<table width="840" border="0" align="center" cellpadding="0" cellspacing="0">
					<tr>
						<td width="240" class="vvd">会员ID</td>
						<td width="150" class="vvd">股票持有量</td>
						<td width="150" class="vvd">价格</td>
						<td width="300" class="vvd">状态</td>
					</tr>
				</table>
			</div>
			<table width="840" border="0" align="center" cellpadding="0" cellspacing="0">
				<c:forEach var="sotck" items="${page.result }">
					<tr>
						<td width="200" class="vv">${sotck.userId}</td>
						<td width="120" class="vv">${sotck.stockNum }</td>
						<td width="120" class="vv">${sotck.price}</td>
						<td width="200" class="vv">
						<fmt:formatDate value="${sotck.buyDate}" pattern="yyyy-M-dd HH:mm:ss" /></td>
					</tr>
				</c:forEach>
			</table>
			<%@ include file="/common/turnpage.jsp"%>
		</div> --%>

		<!--  -->
        </div> 
        <div class="news_down"><img src="<c:url value='/resources/images/down.jpg'/>" /></div>
    </div>
    </div>
</div>

</body>
</html>
<script>
function toBuy(){
	$.ajaxSetup({cache:false});
	var checkFlg = true;
	checkFlg = checkFlg && validateEmpty_jquery("交易量", "buynum");
	checkFlg = checkFlg && validateNumber_Integer("交易量 ", "buynum");
	var toBuy = $("#toBuy").val();
	var buy = $("#buynum").val();
	if(dcmSub(toBuy,buy)<0){
		alert("对不起，您的股金不足，请重新输入交易量");
		return;
	}
	checkFlg = checkFlg && validateEmpty_jquery("三级密码", "thirdPassword1");
	//checkFlg = checkFlg && false;
	$.ajax({
		type:'POST',
		url: "${ctx}/chkTidPwd.action",
		data: "thirdPassword="+$("#thirdPassword1").val(),
		dataType:"html",
        async:false,  // 设置同步方式
        cache:false,
		success: function(data,status){
			if($.trim(data)!=''){
				setValidateErrorStyle_jquery($("#thirdPassword1"));
				alert(data);
				checkFlg = checkFlg && false;
			}
		},
		error: function(data,status,e){
			alert(e.name);
		}
	});
	
	if(!checkFlg) return false;
	if(checkFlg){
		
		window.location.href = "${ctx}/stocktrade.action?stocknum="+$("#buynum").val()+"&type=0&price="+$("#price").val();
		/* var price = $("#price").val();
		$.ajax({
			type:'POST',
			url: "${ctx}/stocktrade.action",
			data: "buynum="+$("#buynum").val()+"&type=0&price="+price,
			dataType:"html",
			success: function(data,status){
				if($.trim(data)!=''){
					alert(data);
				}
			},
			error: function(data,status,e){
				alert(e.name);
			}
		}); */
	}
}

function toSale(){
	$.ajaxSetup({cache:false});
	var checkFlg = true;
	var tosale = $("#toSale").val();
	if(tosale == '0'){
		alert("对不起，您可卖出的股票为0，不能沽出股票!");
		return;
	}
	checkFlg = checkFlg && validateEmpty_jquery("交易量", "salenum");
	var sale = $("#salenum").val();
	if(dcmSub(tosale,sale)<0){
		alert("对不起，您的交易量大于您的股票量，请重新填写交易量!");
		return;
	}
	checkFlg = checkFlg && validateNumber_Integer("交易量 ", "salenum");
	checkFlg = checkFlg && validateEmpty_jquery("三级密码", "thirdPassword2");
	//checkFlg = checkFlg && false;
	$.ajax({
		type:'POST',
		url: "${ctx}/chkTidPwd.action",
		data: "thirdPassword="+$("#thirdPassword2").val(),
		dataType:"html",
        async:false,  // 设置同步方式
        cache:false,
		success: function(data,status){
			if($.trim(data)!=''){
				setValidateErrorStyle_jquery($("#thirdPassword2"));
				alert(data);
				checkFlg = checkFlg && false;
			}
		},
		error: function(data,status,e){
			alert(e.name);
		}
	});
	if(!checkFlg) return false;
	if(checkFlg){
		window.location.href = "${ctx}/stocktrade.action?stocknum="+$("#salenum").val()+"&type=1&price="+$("#price").val();
		/* $.ajax({
			type:'POST',
			url: "${ctx}/stocktrade.action",
			data: "salenum="+$("#salenum").val()+"&type=1&price="+$("#price").val(),
			dataType:"html",
			success: function(data,status){
				if($.trim(data)!=''){
					alert(data);
					location = "${ctx}/youxidou.action";
				}
			},
			error: function(data,status,e){
				alert(e.name);
			}
		}); */
	}
}

function nextpage(pageNo){
	window.location.href = "${ctx}/youxidou.action?pageNo="+pageNo;
}
function frontpage(pageNo) {
	window.location.href = "${ctx}/youxidou.action?pageNo="+pageNo;
}
</script>